@using Piranha.Manager
@inject ManagerLocalizer Localizer
@inject IAuthorizationService Auth
@{
    var menu = await Menu.Items.GetForUser(User, Auth);
    var logout = Piranha.App.Modules.Manager().LogoutUrl;
}

<nav class="navbar navbar-left fixed-top navbar-dark bg-dark">
    <a class="navbar-brand" href="~/manager" tabindex="-1"></a>
    <ul class="navbar-nav">
        @foreach (var group in menu)
        {
            <li class="nav-item nav-header"><span class="navbar-text"><i class="@group.Css"></i>@Localizer.Menu[group.Name]</span></li>
            @foreach (var item in group.Items)
            {
                <li class="nav-item@(ViewBag.MenuItem == item.InternalId ? " active" :"")"><a href="@Url.Content(item.Route)" class="nav-link" tabindex="-1"><i class="@item.Css"></i>@Localizer.Menu[item.Name]</a></li>
            }
            @if (group.InternalId == "Content")
            {
                foreach (var item in Piranha.App.ContentGroups.Where(g => !g.IsHidden))
                {
                    <li class="nav-item@(ViewBag.MenuItem == item.Id ? " active" :"")"><a href="@Url.Content($"~/manager/content/{ item.Id }")" class="nav-link" tabindex="-1"><i class="@item.Icon"></i>@item.Title</a></li>
                }
            }
        }
        <li class="nav-item nav-header"><a class="navbar-text" href="@Url.Content(logout)"><i class="fas fa-power-off"></i>@Localizer.Menu["Logout"]</a></li>
    </ul>
</nav>
